<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../Vue全家桶_stu/03_依赖包/vue.js"></script>
    <!-- v-for 用于渲染列表 可循环数组 对象 字符串 数字 -->
</head>

<body>
    <div id="root">
        <ul>
            <!-- v-for遍历 数组 -->
            <li v-for="(item,index) in list" :key="index">
                <p>{{item.name}}</p>
                <!-- v-for可嵌套使用 -->
                <p v-for="(childrenItem,index) in item.children" :key="index">{{childrenItem.name}}</p>
            </li>
        </ul>
    </div>
    <script>
        const vm = new Vue({
            el: '#root',
            data: {
                list: [
                    { name: '首页', children: [{ name: '添加' }, { name: '删除' }] },
                    { name: '添加商品', children: [{ name: '添加' }, { name: '删除' }] },
                    { name: 'spu管理', children: [{ name: '添加' }, { name: '删除' }] },
                    { name: 'sku管理', children: [{ name: '添加' }, { name: '删除' }] },
                ]
            }
        })
    </script>
</body>

</html>